<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.org/ui" xmlns:a4j="http://richfaces.org/a4j"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</h:head>
<h:body>
	<ui:composition template="template.xhtml">

		<ui:define name="title">mehmet emmy</ui:define>
		<ui:define name="body">
			<c:choose>
				<c:when test="${TemsilciBean.currentTemsilci != null}">
					<c:if test="${TemsilciBean.currentTemsilci.yetkisi != 10}">
						<script language="javascript"> 
                    		alert("bu sayfaya erişim yetkiniz yoktur.")                   	
    						redirectPage();
	  	 				</script>
	  	 			</c:if>		
			

					<h:form>
						<p:growl id="growl" sticky="true" showDetail="true" />

						<p:wizard widgetVar="wiz" showStepStatus="true" showNavBar="true">

							<p:tab id="personal" title="Personal">

								<p:panel header="Personal Details" id="person">

									<h:messages errorClass="error"
										style="color: red; font-style: italic; text-decoration: blink" />

									<h:panelGrid columns="3" columnClasses="label, value"
										styleClass="grid">
										<h:outputText value="Tc Kimlik: *" />
										<p:inputText required="true" label="TcKimlik" maxlength="11"
											requiredMessage="TC kimlik boş bırakılamaz"
											converterMessage="TC kimlik yalnızca sayılardan oluşur."
											validatorMessage="TC kimlik 11 rakamdan oluşur."
											value="#{TemsilciBean.newUser.tcKimlik}">
											<p:ajax event="blur" update="tcOut"
												listener="#{TemsilciBean.TcKontrol}" />
											<f:validateLength minimum="11"></f:validateLength>

										</p:inputText>
										<h:outputText id="tcOut" value="#{TemsilciBean.tcKontrolText}" />

										<h:outputText value="İsim: *" />
										<p:inputText required="true" label="isim"
											value="#{TemsilciBean.newUser.ad}" />
										<h:outputText />

										<h:outputText value="soyisim: *" />
										<p:inputText required="true" label="soyisim"
											value="#{TemsilciBean.newUser.soyad}" />
										<h:outputText />

										<h:outputText value="Doğum Tarihi: " />
										<p:inputMask required="true" label="dogumTarihi"
											mask="99/99/9999"
											value="#{TemsilciBean.newUser.dogumTarihi}" />
										<h:outputText />
										
										<h:outputText value="Ünvanı: *" />
										<p:inputText required="true" label="Unvan"
											value="#{TemsilciBean.newUser.unvan}" />
										<h:outputText />
										
										<h:outputText value="Yetkisi: *" />
										<p:inputText required="true" label="Yetkisi"
											value="#{TemsilciBean.newUser.yetkisi}" 
											validatorMessage="Yalnızca rakamdan oluşur."/>
										<h:outputText />

									</h:panelGrid>
								</p:panel>
							</p:tab>

							<p:tab id="address" title="Address">
								<p:panel header="Adress Details">

									<h:messages errorClass="error"
										style="color: red; font-style: italic; text-decoration: blink" />

									<h:panelGrid columns="2" columnClasses="label, value">
										<h:outputText value="il: " />
										<p:inputText value="#{TemsilciBean.newUser.adres.il}"
											required="true" requiredMessage="il boş bırakılamaz" />

										<h:outputText value="ilçe: " />
										<p:inputText value="#{TemsilciBean.newUser.adres.ilce}"
											required="true" requiredMessage="ilçe boş bırakılamaz" />

										<h:outputText value="Mahalle: " />
										<p:inputText
											value="#{TemsilciBean.newUser.adres.mahalle}"
											required="true" requiredMessage="mahalle boş bırakılamaz" />

										<h:outputText value="Sokak: " />
										<p:inputText value="#{TemsilciBean.newUser.adres.sokak}"
											required="true" requiredMessage="Sokak boş bırakılamaz" />

										<h:outputText value="Numara: " />
										<p:inputText
											value="#{TemsilciBean.newUser.adres.numara}"
											required="true" requiredMessage="numara boş bırakılamaz" />

									</h:panelGrid>
								</p:panel>
							</p:tab>

							<p:tab id="contact" title="Contact">
								<p:panel header="Contact Information">

									<h:messages errorClass="error"
										style="color: red; font-style: italic; text-decoration: blink" />

									<h:panelGrid columns="2" columnClasses="label, value">
										<h:outputText value="Email: *" />
										<p:inputText required="true" label="Email"
											value="#{TemsilciBean.newUser.email}"
											requiredMessage="e-mail boş bırakılamaz" />

										<h:outputText value="Tel 1: " />
										<p:inputText value="#{TemsilciBean.newUser.tel1}"
											required="true" requiredMessage="Tel no boş bırakılamaz" />

										<h:outputText value="Tel 2: " />
										<p:inputText value="#{TemsilciBean.newUser.tel2}" />

										<h:outputText value="Fax: " />
										<p:inputText value="#{TemsilciBean.newUser.fax}" />

										<h:outputText value="Web Adresi: " />
										<p:inputText
											value="#{TemsilciBean.newUser.kisiselWebAdd}" />
									</h:panelGrid>
								</p:panel>
							</p:tab>

							<p:tab id="kullaniciInfo" title="Login info">
								<p:panel header="Login Information" id="klcInfo">

									<h:messages errorClass="error"
										style="color: red; font-style: italic; text-decoration: blink" />

									<h:panelGrid columns="3" columnClasses="label, value">
										<h:outputText value="Kullanıcı Adı: *" />
										<p:inputText required="true" label="kullaniciAdi"
											id="klcInput"
											value="#{TemsilciBean.newUser.kullanici.kullaniciAdi}"
											requiredMessage="Kullanıcı Adı boş bırakılamaz"
											validatorMessage="En az 5 karakter olmalı.">

											<p:ajax event="blur" update="klcOut,klcInput"
												listener="#{TemsilciBean.kullaniciAdKontrol}" />
											<f:validateLength minimum="5" />
										</p:inputText>
										<h:outputText id="klcOut"
											value="#{TemsilciBean.klcAdKontrolText}" />

										<h:outputLabel for="pwd1" value="Password 1: *" />
										<p:password id="pwd1"
											value="#{TemsilciBean.newUser.kullanici.parola}"
											feedback="true" promptLabel="Lütfen şifre giriniz"
											weakLabel="Zayıf" goodLabel="Orta seviye" strongLabel="Güçlü"
											match="pwd2" label="Password 1" required="true"
											validatorMessage="Parola tekrarı hatalı" />
										<h:outputText />

										<h:outputLabel for="pwd2" value="Parola tekrar:: *" />
										<p:password id="pwd2"
											value="#{TemsilciBean.newUser.kullanici.parola}"
											label="Password 2" required="true" />
										<h:outputText />

									</h:panelGrid>
								</p:panel>
							</p:tab>

							<p:tab id="confirm" title="Confirmation">
								<p:panel header="Confirmation">

									<h:panelGrid id="confirmation" columns="6" rules="all">
										<h:outputText value="Tc Kimlik: " style="color:red" />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.tcKimlik}" />

										<h:outputText value="Ad: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.ad}" />

										<h:outputText value="Soyad: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.soyad}" />

										<h:outputText value="Doğum Tarihi: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.dogumTarihi}" />

										<h:outputText value="Grup: " />
										<h:outputText styleClass="outputLabel" value="Müşteri" />

										<h:outputText value="İl: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.adres.il}" />

										<h:outputText value="İlçe: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.adres.ilce}" />

										<h:outputText value="Mahalle: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.adres.mahalle}" />

										<h:outputText value="Sokak: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.adres.sokak}" />

										<h:outputText value="Numara " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.adres.numara}" />

										<h:outputText value="Email: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.email}" />

										<h:outputText value="Tel 1: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.tel1}" />

										<h:outputText value="Tel 2: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.tel2}" />

										<h:outputText value="Fax: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.fax}" />

										<h:outputText value="Web Page: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.kisiselWebAdd}" />

										<h:outputText value="Kullanıcı Adı: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.kullanici.kullaniciAdi}" />

										<h:outputText value="Parola: " />
										<h:outputText styleClass="outputLabel"
											value="#{TemsilciBean.newUser.kullanici.parola}" />


									</h:panelGrid>

									<p:commandButton value="Kaydet" update="growl"
										actionListener="#{TemsilciBean.saveNewUser}"
										oncomplete="setTimeout('refreshPage();' , 3000);" />

								</p:panel>
							</p:tab>

						</p:wizard>
					</h:form>
				</c:when>
				<c:otherwise>
					<script language="javascript"> 
                    	alert("bu sayfaya erişim yetkiniz yoktur.")                   	
    					redirectPage();
	  	 			</script>
				</c:otherwise>
			</c:choose>
		</ui:define>
	</ui:composition>
</h:body>
</html>